﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace YouTubeStormer
{
    class Captcha
    {
        DeathByCaptcha.Client client = new DeathByCaptcha.Client();

        public bool PerformLogin(string username, string password)
        {
            return client.Login(username, password);
        }

        public void ReportCaptcha(int ID)
        {
            client.Report(ID, false);
        }

        public string SolveCatpcha(byte[] image, out int ID)
        {
            ID = client.Upload(image);
            if (0 < ID)
            {
                string text = client.GetText(ID);
                if ("" != text)
                {
                    return text;
                }
                else
                {
                    client.Remove(ID);
                    return "";
                }
            }
            else
            {
                return "";
            }
        }
    }
}
